using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class OldMemberLogin : System.Web.UI.Page 
{
    protected void Page_Load(object sender, EventArgs e)
    {
        Login1.Focus();
    }


    protected void Login1_LoggedIn(object sender, EventArgs e)
    {
        LMSData.AuditLogin al = new LMSData.AuditLogin();
        al.UserName = Membership.GetUser(Login1.UserName).Email;
        al.IPAddress = Request.ServerVariables["REMOTE_ADDR"];
        al.Browser = Request.ServerVariables["HTTP_USER_AGENT"];
        al.Platform = Request.Browser.Platform;
        al.BrowserVersion = Request.Browser.Version;
        al.LoginDate = DateTime.Now;
        al.UserID = (int)Membership.GetUser(Login1.UserName).ProviderUserKey;
        al.Success = true;
        al.Save();

        
        if (Request["ReturnUrl"] == String.Empty)
            Response.Redirect("~/LoggedIn.aspx");
    }
    protected void Login1_LoginError(object sender, EventArgs e)
    {
        LMSData.AuditLogin al = new LMSData.AuditLogin();
        al.UserName = Login1.UserName;
        al.IPAddress = Request.ServerVariables["REMOTE_ADDR"];
        al.Browser = Request.ServerVariables["HTTP_USER_AGENT"];
        al.Platform = Request.Browser.Platform;
        al.BrowserVersion = Request.Browser.Version;
        al.LoginDate = DateTime.Now;
        al.Success = false;
        al.Save();
    }


    
}